<template>
	<div class="productinfo-box">
			<div class="pinfo-box">
				<el-row>
					<el-col :span="4" style="text-align: right;">赠送积分：</el-col>
					<el-col :span="20"><el-input v-model="productinfo.giftPoint" type="text"  size="small" class="iptext"/></el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">赠送成长值：</el-col>
					<el-col :span="20"><el-input v-model="productinfo.giftGrowth"  type="text" size="small" class="iptext" /></el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">积分购买限制：</el-col>
					<el-col :span="20"><el-input type="text" v-model="productinfo.usePointLimit"  class="iptext" /></el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">预告商品：</el-col>
					<el-col :span="20">
						<el-switch size="small" v-model="productinfo.previewStatus"  :active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949" />
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">商品上架：</el-col>
					<el-col :span="20">
						<el-switch size="small" v-model="productinfo.publishStatus" active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949" />
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">商品推荐：</el-col>
					<el-col :span="20">
						新品:
						<el-switch size="small" v-model="productinfo.newStatus" :active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949" />
						推荐:
						<el-switch size="small" v-model="productinfo.recommandStatus"   :active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949" />
					</el-col>	
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">服务保证：</el-col>
					<el-col :span="20">
						   <el-checkbox-group v-model="checkList">
						      <el-checkbox label="无忧退货"></el-checkbox>
						      <el-checkbox label="快速退款"></el-checkbox>
						      <el-checkbox label="免费包邮"></el-checkbox>
						    </el-checkbox-group>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">详细页标题：</el-col>
					<el-col :span="20"><el-input v-model="productinfo.detailTitle" type="text"  size="small" class="iptext"/></el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">详细页描述：</el-col>
					<el-col :span="20"><el-input v-model="productinfo.detailDesc" type="text" size="small"  class="iptext"/></el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">商品关键字：</el-col>
					<el-col :span="20"><el-input v-model="productinfo.keywords" type="text" size="small"  class="iptext" /></el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">商品备注：</el-col>
					<el-col :span="20"><el-input v-model="productinfo.note" type="text"  size="small" class="iptext" /></el-col>
				</el-row>
				<el-row>
					<el-col :span="4" style="text-align: right;">选择优惠方式：</el-col>
					<el-col :span="20"></el-col>
				</el-row>
			</div>
			<div class="btn-box">
				<el-button size="small" type="primary" @click="m1(-1)">上一步，填写商品信息</el-button>
				<el-button size="small" type="primary" @click="m1(1)">下一步，填写商品属性</el-button>
			</div>
		</div>
</template>

<script>
	export default {
		data(){
			return {
				checkList:['无忧退货']
			}
		},
		props:["pageNum","productinfo"],
		watch:{
			checkList(val){
				this.productinfo.serviceIds = [];    //  1,2,3
				val.forEach(item=>{
					if(item == "无忧退货"){
						this.productinfo.serviceIds.push(1);
					}else if(item == "快速退款"){
						this.productinfo.serviceIds.push(2);
					}else if(item == "免费包邮"){
						this.productinfo.serviceIds.push(3);
					}
				})
				this.productinfo.serviceIds = this.productinfo.serviceIds.join(",");
			}
		},
		methods:{
			m1(num){
				//触发自定义函数
				let tmp = parseInt(this.pageNum)+num;
				console.log('tomp,',tmp);
				this.$emit("changeStatus",tmp);
			}
		}
	}
</script>

<style lang="scss" scoped="scoped">
	.el-row{
		line-height: 50px;
	}
</style>
